package com.zyx.mybatisdemo.dao;

import com.zyx.mybatisdemo.entity.Emp;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @author zyx
 * @since 2021/8/30 21:27
 */
public interface EmpDao {
    /**
     * 查询所有员工的信息
     *
     * @return 所有员工信息
     */
    List<Emp> queryAll();

    /**
     * query a emp by id
     * @param id emp id
     * @return emp result
     */
    Emp queryOneById(Integer id);


    /**
     * 通过表名及ID查询员工信息
     *
     * @param tblName 表名
     * @param id      员工ID
     * @return Emp POJO
     */
    Emp queryByTblNameAndId(@Param("tblName") String tblName, @Param("id") int id);

    /**
     * query emp and dept by emp id
     *
     * @param id emp id
     * @return emp and dept
     */
    Emp queryEmpAndDeptBySimple(Integer id);

    /**
     * query emps by deptid
     *
     * @param deptid dept id
     * @return emps with given deptid
     */
    List<Emp> queryEmpByStep(Integer deptid);

    /**
     * query emp by condition
     * @param emp paramed emp
     * @return emp returned
     */
    Emp queryEmpByCondition(@Param("emp") Emp emp);

    /**
     * query emp by dept ids
     * @param ids query ids
     * @return emp list
     */
    List<Emp> queryEmpByDeptIds(@Param("ids") List<Integer> ids);

    /**
     * update name by id
     * @param emp param emp
     * @return rows effected
     */
    Integer updateNameById(Emp emp);
}
